type Props = {
    count: number
    pageIndex: number
    pageSize: number
}
class Pagination {
    count: number
    pageIndex: number
    pageSize: number

    constructor(props: Props) {
        this.count = props.count
        this.pageIndex = props.pageIndex
        this.pageSize = props.pageSize
    }

    hasNextPage(): boolean {
        return this.pageIndex * this.pageSize < this.count;
    }

    nextPage = () => {
        if (this.hasNextPage()) {
            this.pageIndex += 1
            return this.pageIndex
        }
        return false
    }

    previousPage(): void {
        if (this.pageIndex > 1) {
            this.pageIndex -= 1;
        }
    }

}

export default Pagination